<?php session_start();
require('globals/setup.php');
$smarty = new Smarty_Kalender;	

$host  = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_NAME'] == 'localhost'){$uri= URI_L;}else{$uri= URI_P;}
if (!isset($_SESSION['id_user']) || $_SESSION['id_user']=='') {
	echo "<script language=Javascript> location.href='http://$host$uri/index.php'; </script>";	
}else{
	
	if (!is_object($bd)){	
		require("globals/Db.class.php");
		require("globals/Conf.class.php");
		$bd=Db::getInstance();
	}
	if (!is_object($util)){	
		include("globals/Util.class.php");
		$util=Util::getInstance();
	}
		
	if (!($util->administrarTiempoSesion())){
		echo "<script language=Javascript> location.href='http://$host$uri/timeout.php'; </script>";
	}else if (!($util->administrarAcceso("facturacion"))){
		echo "<script language=Javascript> location.href='http://$host$uri/sinAcceso.php'; </script>";
	}
	
	$id_user = $_SESSION['id_user'];

	
	$query = " select id, codigo, valor from valores_servicios;";
	$resultado = $bd->eje($query);		
	$num_rows = $bd->numRows($resultado);
	
	$array_resultado = array();
	for ($i=0; $i<$num_rows; $i++){
		$row = $bd->fila($resultado);
		$array_linea["id"] = $row["id"];
		$array_linea["nombre"] = $util->decodeFileType($row["codigo"]);
		$array_linea["valor"] = $row["valor"];
		$array_linea["tipo_elem"] = $row["codigo"];
		array_push($array_resultado, $array_linea);
	}
	$smarty->assign("array_resultado", $array_resultado);
	
	$smarty->assign("menuItem", "facturacion");
	include("globals/menuIzquierda.php");			
	$smarty->display("editorImportes.tpl");
	

} //del if grande ?>